package com.bjb.vr.operation.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @version 1.0.0
 * @author: HuJingBo
 * @time: 2022/4/14 16:08
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Value("${local.file.view.path:/local/static/}")
    private String fileViewPath;

    @Value("${local.file.upload.path:/data/resource/upload/}")
    private String fileUploadPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(fileViewPath + "**").addResourceLocations("file:" + fileUploadPath);
    }
}
